const App = {
    mixins: [Save],//配置文件，路径/utils/mixins.js
    data() {
        return {
            category: [],
            village: [],
            personal_information: [],
            village_Collective: [],
            Change_Type: [{ label: '新增', value: '1' }, { label: '折旧', value: '2' }, { label: '维修', value: '3' }, { label: '处置', value: '4' }]
        };
    },
    mounted() {
        let ls_URL = window.location.href;
        let Asset_SerialNumber = getQueryObject(ls_URL, "Asset_SerialNumber");// 获取 nodeKey 参数
        if (Asset_SerialNumber) {
            this.dataForm.Asset_SerialNumber = Asset_SerialNumber;
        }
        this.getCategory();
    },
    watch: {
        'dataForm.Village_Collective_SerialNumber'(val) {
            if (this.action == 'Modify') {
                this.changeVillage(this.dataForm.Village_SerialNumber);
            }
        }
    },
    methods: {
        handleChangeCurrent_Value(val) {
            this.dataForm.Acquisition_Price = val;
        },
        changeVillage(val) {
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/generalBusiness/generalQueryByTableName`,
                type: "POST",
                data: {
                    Data: 'village_collective',
                    Condition: "Row_Status='0' AND VillageNumber='" + val + "'"
                },
                success: (data) => {
                    this.village_Collective = data; // 直接使用 this
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest);
                },
                dataType: "json",
            });
        },
        getCategory() {
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/generalBusiness/generalQueryByTableName`,
                type: "POST",
                data: {
                    Data: 'asset_category',
                    Condition: "Row_Status='0'",
                },
                success: (data) => {
                    this.category = data; // 直接使用 this
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest);
                },
                dataType: "json",
            });
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/generalBusiness/generalQueryByTableName`,
                type: "POST",
                data: {
                    Data: 'personal_information',
                    Condition: "Row_Status='0'",
                },
                success: (data) => {
                    this.personal_information = data; // 直接使用 this
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest);
                },
                dataType: "json",
            });
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/permissionsTree/getDistrictTreeByPermissions`,
                type: "GET",
                data: {
                    DistrictCode: getCookie('village'),
                },
                success: (data) => {
                    this.village = data; // 直接使用 this
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest);
                },
                dataType: "json",
            });
        },
        success(res) {
            this.dataForm.Video_Path = res.Path;
        }
    },
};
const { createApp, ref } = Vue;
const app = createApp(App);
app.use(ElementPlus, { locale: zhCn });
//这种方式是引入全部图标，无需单个引入
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component);
}
app.component('yl-upload', ylUpload);
const ElMessage = ElementPlus.ElMessage;
app.mount("#app");
